#pragma once
#include <GRendererInfra/GRiVertex.h>
#include <GGenericInfra/GGiEngineUtil.h>
#include <limits>
#include <GRendererInfra/GRiMaterial.h>

struct HitInfo
{
	HitInfo() :
		isHit(false),
		isLight(false),
		mat(){
		t = GGiEngineUtil::GetMax();
	}
	~HitInfo() {};
	GRiMaterial mat;
	GMath::Vector3 emission;
	float t;
	GRiVertex p;
	bool isHit;
	bool isLight;
};
class GRTXRay
{
public:
	GRTXRay(const GMath::Vector3& o, const GMath::Vector3& d) :Orgin(o), Dir(d) {};
	GRTXRay() = default;
	GMath::Vector3 Orgin;
	GMath::Vector3 Dir;
};

inline GMath::Vector3 GetRandomRay()
{
	GMath::Vector3 dir;
	float theta = GGiEngineUtil::GetRandom() * GGiEngineUtil::PI_2;
	float phi = GGiEngineUtil::GetRandom() * GGiEngineUtil::PI_2;
	dir[0] = cos(phi) * sin(theta);
	dir[1] = sin(phi) * sin(theta);
	dir[2] = cos(theta);
	return dir;
}